<?php 
$this->load->view('common/head'); 
$this->load->view('common/header');
?>
<script src='https://www.google.com/recaptcha/api.js'></script>
<script type="text/javascript" src="<?php echo ASSET_URL; ?>js/jquery-1.10.2.js"></script>    <!-- Image -->  
<img src="<?php echo ASSET_URL.'img/masterslider/02.jpg';?>" alt="">  
<script type="text/javascript" >    

$(document).ready(function(){
$("#register1").click(function(){
var name_pattern=/^[A-Za-z0-9][A-Za-z0-9&.)(\-\, ]+$/;	
var email_pattern=/^[_A-Za-z0-9-]+(\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*(\.[A-Za-z]{2,12})$/;
if($("#fname").val() =="")
	{
	$('#err-first').html('Please enter first name');
	$('#err-first').show(500);
	$('#err-first').delay(4000);
	$('#err-first').animate({
	height: 'toggle' 
	}, 500, function() {
	// Animation complete.
	});
	$("#namefull").focus();
	}
else if(!name_pattern.test($("#fname").val())){
		$('#err-first').html('Special character are not allowed');
		$('#err-first').show(500);
		$('#err-first').delay(4000);
		$('#err-first').animate({
		height: 'toggle' 
		}, 500, function() {
		// Animation complete.
		});
		$("#fname").focus();
		}
else if($("#lastname").val() =="")
	{
	$('#err-last').html('Please enter last name');
	$('#err-last').show(500);
	$('#err-last').delay(4000);
	$('#err-last').animate({
	height: 'toggle' 
	}, 500, function() {
	// Animation complete.
	});
	$("#lastname").focus();
	}
else if(!name_pattern.test($("#lastname").val())){
		$('#err-last').html('Special character are not allowed');
		$('#err-last').show(500);
		$('#err-last').delay(4000);
		$('#err-last').animate({
		height: 'toggle' 
		}, 500, function() {
		// Animation complete.
		});
		$("#lastname").focus();
		}		
else if($("#emailid").val() =="")
	{
	$('#err-email').html('Please enter Email');
	$('#err-email').show(500);
	$('#err-email').delay(4000);
	$('#err-email').animate({
	height: 'toggle' 
	}, 500, function() {
	// Animation complete.
	});
	$("#emailid").focus();
	}
else if(!email_pattern.test($("#emailid").val()))
	{
	$('#err-email').html('Please enter a valid email');
	$('#err-email').show(500);
	$('#err-email').delay(4000);
	$('#err-email').animate({
	height: 'toggle' 
	}, 500, function() {
	// Animation complete.
	});
	$("#emailid").focus();
	}
else if($("#Country").val() =="")
	{
	$('#err-Country').html('PLease select the country');
	$('#err-Country').show(500);
	$('#err-Country').delay(4000);
	$('#err-Country').animate({
	height: 'toggle' 
	}, 500, function() {
	// Animation complete.
	});
	$("#Country").focus();
	}
		
else if($("#npassword").val() =="")
	{
	$('#err-npassword').html('Please enter Password');
	$('#err-npassword').show(500);
	$('#err-npassword').delay(4000);
	$('#err-npassword').animate({
	height: 'toggle' 
	}, 500, function() {
	// Animation complete.
	});
	$("#npassword").focus();
	}
else if($("#cpassword").val() =="")
	{
		$('#err-cpassword').html('Please enter Password');
		$('#err-cpassword').show(500);
		$('#err-cpassword').delay(4000);
		$('#err-cpassword').animate({
		height: 'toggle' 
		}, 500, function() {
		// Animation complete.
		});
		$("#cpassword").focus();
	}
else if(grecaptcha.getResponse() == "")
	{
    	$('#err-captcha').html('Please prove that you are human');
		$('#err-captcha').show(500);
		$('#err-captcha').delay(4000);
		$('#err-captcha').animate({
		height: 'toggle' 
		}, 500, function() {
		// Animation complete.
		});
	}
else if(!$("#conditions").is(':checked'))
{
		$('#err-conditions').html('Please accept terms & conditions');
		$('#err-conditions').show(500);
		$('#err-conditions').delay(4000);
		$('#err-conditions').animate({
		height: 'toggle' 
		}, 500, function() {
		// Animation complete.
		});
}
else
	{	
		$("#registerform").submit();
	}
});
});

</script>
   <!-- Content -->    
  <div class="space40"></div>

  <div class="container">
    <div class="row"> 
      <div class="col-md-12">
        <h1>Register</h1>
      </div>
    </div>    
  </div>    
  
  <div class="space20"></div>  
  
  <div class="container">
    <div class="row"> 
      <div class="center-block">  
        <span class="success_msg"><?php echo $this->session->userdata('message'); $this->session->unset_userdata('message'); ?></span>
        <!-- Form -->
        <form role="form" id="registerform" action="" method="post" class="contact-form">
          <div class="row">            
            <div class="form-group col-sm-6">
              <label for="name2">First Name </label>
              <input class="form-control" id="fname" name="fname" type="text" value="<?php echo $this->input->post('fname');?>" onBlur="this.value=jQuery.trim(this.value)">
              <div class="error" id="err-first"></div>
               <span class="error_msg"><?php echo form_error('fname'); ?></span>
            </div>
            <div class="form-group col-sm-6">
              <label for="name3">Last Name</label>
              <input  class="form-control" id="lastname" name="lastname"  type="text" value="<?php echo $this->input->post('lastname'); ?>" onBlur="this.value=jQuery.trim(this.value)">
              <div class="error" id="err-last"></div> 
               <span class="error_msg"><?php echo form_error('lastname'); ?></span>
            </div>
          </div>      
           <div class="row">            
            <div class="form-group col-sm-6">
              <label for="email2">Email </label>
              <input  class="form-control" id="emailid" name="email"  type="text" value="<?php echo $this->input->post('email'); ?>" onBlur="this.value=jQuery.trim(this.value)">
              <div class="error" id="err-email"></div>
               <span class="error_msg"><?php echo form_error('email'); ?></span>
            </div>
            <div class="form-group col-sm-6">
              <label for="country">Country</label>
              <select class="form-control" name="country" id="Country">
              <option  value="">--Select Counrty--</option>	
              <?php foreach($query as $row)	{ ?>
              	<option value="<?php echo $row->country_id; $line=$row->country_id ?>" <?php if($this->input->post('counrty') && $line==$this->input->post('counrty')){ echo 'selected';  }  ?>><?php echo $row->country_name;?></option>
			  <?php } ?>
              </select>
              <?php echo form_error('counrty'); ?>
              
              <div class="error" id="err-Country"></div> 
            </div>
          </div>                
          <div class="row">
          <div class="form-group col-sm-6">
              <label for="password2">Password</label>
              <input  class="form-control" id="npassword" name="password"  type="password" value="" onBlur="this.value=jQuery.trim(this.value)">
              <div class="error" id="err-npassword"></div> 
               <span class="error_msg"><?php echo form_error('password'); ?></span>
            </div>            
            <div class="form-group col-sm-6">
              <label for="confirm_password2">Confirm Password</label>
              <input  class="form-control" id="cpassword" name="cpassword"  type="password" value="" onBlur="this.value=jQuery.trim(this.value)">
              <div class="error" id="err-cpassword"></div>
              <span class="error_msg"> <?php echo form_error('cpassword'); ?></span>
            </div>
            
          </div>            
          <div class="row">
          	<div class="form-group col-sm-6">
              <div class="g-recaptcha" data-sitekey="6LdHuwETAAAAAFbIL8OY2smcoIen5V13VOY0UNqm"></div>
              <span class="error_msg" id="err-captcha"></span>
            </div>
            
            <div class="form-group col-sm-6" style="margin-top:40px;">
              <input  class="" id="conditions" name="conditions" value=""  type="checkbox" ><label for="terms_and_conditions">&nbsp; I accept all </label> <a href="#">Terms and Conditions</a>
              <div class="error" id="err-conditions"></div> 
              <span class="error_msg"><?php echo form_error('conditions'); ?></span>
            </div>
                       
          </div>    
          <div class="row">            
            <div class="col-md-12 text-center">
              <button type="button" class="btn btn-primary" id="register1">Register</button>  
            </div>
          </div>
        </form>
        <!-- Form End -->
          
      </div>    

    </div> 
  </div> 
  
  <div class="space30"></div>  
  
  <!-- Content End -->
           
<?php $this -> load -> view('user/footer'); ?>